<?php
/**
 * @author		João Batista Neto
 * @package		rpo
 * @subpackage	http\exception
 * @category	Http
 * @license		http://opensource.org/licenses/gpl-license.php GNU Public License
 */
namespace rpo\http\exception;

use rpo\http\exception\interfaces\AbstractClientException;
use \Exception;

/**
 * The request requires user authentication.
 * <p>
 * The response MUST include a WWW-Authenticate header field (section 14.47) containing a challenge applicable to the requested resource.
 * The client MAY repeat the request with a suitable Authorization header field (section 14.8).
 * If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused
 * for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already
 * attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since
 * that entity might include relevant diagnostic information. HTTP access authentication is explained in
 * "HTTP Authentication: Basic and Digest Access Authentication"</p>
 * @author		João Batista Neto
 * @final
 * @package		rpo
 * @subpackage	http\exception
 * @category	Http
 * @license		http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link		http://www.w3.org/Protocols/rfc2616/rfc2616-sec17.html#bib43
 */
final class UnauthorizedException extends AbstractClientException {
	/**
	 * Constroi o objeto da exceção
	 * @param string $message A exceção
	 * @param Exception $parent
	 */
	public function __construct( $message , Exception $previous = null ){
		parent::__construct( $message , 401 , $previous );
	}
}